{{template "frame.html" .}}
{{define "base"}}


<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">
            教师管理平台
        </div><!-- 头部区域（可配合layui已有的水平导航） -->

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;"><img src="" class="layui-nav-img base-img"> <script>document.write(getCookie("Name"))</script> </a>
                <dl class="layui-nav-child">
                    <dd>
                        <a class="information">基本资料</a>
                    </dd>
                    <dd>
                        <a class="EditPassword">修改密码</a>
                    </dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="/exit" onClick="return confirm('确定退出?');">退出</a>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed" id="teacher-left-stu">
                    <a class="" href="javascript:;">学生管理</a>
                    <dl class="layui-nav-child" >
                        <dd>
                            <a href="/teacher">总列表</a>
                        </dd>
                        <dd>
                            <a href="/teacher/scl90">学生分析</a>
                        </dd>
                        <dd>
                            <a href="/teacher/stu_add">添加学生</a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item" id="teacher-left-que">
                    <a href="javascript:;">试卷</a>
                    <dl class="layui-nav-child" >
                        <dd>
                            <a href="/teacher/Paper">所有试卷</a>
                        </dd>
                        <dd>
                            <a href="/teacher/Paper/finish">完成情况</a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item" id="teacher-left-client">
                    <a href="/teacher/client">消息</a>
                </li>
                <li class="layui-nav-item" id="teacher-left-Carousel">
                    <a href="/teacher/Carousel">轮播图设置</a>
                </li>
                <li class="layui-nav-item" id="teacher-left-Booking">
                    <a href="/teacher/Booking">预约</a>
                </li>
            </ul>
        </div>
    </div>
    <div class="layui-body" style="overflow: auto;">
        <!-- 内容主体区域 -->
            {{block "content" .}}
            {{end}}
    </div>
    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<script type="text/javascript">
    $(".base-img").attr("src","/static/images/avatar/teacher/"+getCookie("Id")+".png")
    url = window.location.pathname; /* 获取文件路径（文件地址） */
    var stuChoose= $("#teacher-left-stu dl dd")/* 学生管理选项 */
    var queChoose= $("#teacher-left-que dl dd")/* 试卷管理选项 */
    switch(url){
        case "/teacher/":
            stuChoose.eq(0).addClass("layui-this")
            break;
        case "/teacher/scl90":
            stuChoose.eq(1).addClass("layui-this")
            break;
        case "/teacher/stu_add":
            stuChoose.eq(2).addClass("layui-this")
            break;
        case "/teacher/Paper":
            $("#teacher-left-que").addClass("layui-nav-itemed")
            queChoose.eq(0).addClass("layui-this")
            break;
        case "/teacher/Paper/finish":
            $("#teacher-left-que").addClass("layui-nav-itemed")
            queChoose.eq(1).addClass("layui-this")
            break;
        case "/teacher/client":
            $("#teacher-left-client").addClass("layui-this")
            break
        case "/teacher/Carousel":
            $("#teacher-left-Carousel").addClass("layui-this")
            break;
        case "/teacher/Booking":
            $("#teacher-left-Booking").addClass("layui-this")
            break;
    }
    $(".information").click(function (){
        layer.open({
            type: 2,
            title: '基本资料',
            maxmin: true,
            skin: 'layui-layer-lan',
            shadeClose: true, //点击遮罩关闭层
            area : ['700px' , '600px'],
            content:'/public/information/1/'+getCookie("Id")//弹框显示的url,对应的页面
        });
    })
    $(".EditPassword").click(function (){
        layer.prompt({
            formType: 0,
            value: $(".score-Line").text(),
            title: '修改新密码',
            btn: ['确定','取消'], //按钮，
            btnAlign: 'c'
        }, function(value,index){
            $.ajax({
                method:"post",
                url:"/public/EditPassword/"+getCookie("Id"),
                data:{
                    Status:getCookie("Status"),
                    password:value,
                },
                success:function (res){
                    if (res.code==0){
                        layer.msg(res.msg,{icon: res.icon, time: 1000},function(){
                            console.log(res.id)
                            layer.close(index);
                        }); //提交成功后刷新页面
                    }
                }
            })
        });
    })
</script>

{{end}}